Description:
class members should be referenced by the names
of classes where these members are defined.
If a
class member is referenced through a descendant type,
an error message is generated.
Incorrect:
type
Animal = class
class var
populationCount: integer;
end;
Elephant = class(Animal)
public
function getPopulation(): integer;
end;
implementation
function Elephant.getPopulation() : integer;
begin
Result := Elephant.populationCount;
end;
Correct:
type
Animal = class
class var
populationCount: integer;
end;
Elephant = class(Animal)
public
function getPopulation(): integer;
end;
implementation
function Elephant.getPopulation() : integer;
begin
Result := Animal.populationCount;
end;